package com.pavelk.orion.view
{
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	import com.pavelk.orion.view.components.ProgressView;
	
	public class ProgressViewMediator extends BaseMediator implements IMediator
	{
		public static const NAME:String	= 'ProgressViewMediator';
		
		private var progressView:ProgressView;
		
		public function ProgressViewMediator( viewComponent:Object )
		{
			super( NAME, viewComponent );
		}
		
		override public function onRegister():void
		{
			progressView = new ProgressView();
			//progressView.hide();
			viewComponent.addChild( progressView );
		}
		
		override public function listNotificationInterests() : Array 
        {
            return [ 
						ApplicationConstants.LOADING_TYPE,
						ApplicationConstants.PROGRESS_ASSETS                  	
                   ];
        }
        
        override public function handleNotification( note:INotification ) : void 
        {
            switch ( note.getName() ) 
            {
	             case ApplicationConstants.LOADING_TYPE:
	             	progressView.loadingType( note.getBody() as String );
	             	break;	
	             case ApplicationConstants.PROGRESS_ASSETS:
	                progressView.progressLoader( note.getBody() as String );
	                break;   	  		  	
            }
        }


	}
}